<%= will_filter_scripts_tag %>

<%= tr8n_actions_tag([
    link_to_function("Add Languages", "Tr8n.UI.Lightbox.show('/tr8n/admin/applications/lb_add_objects?type=language&id=#{@app.id}', {height:450})"),
  ])
%>

<%= form_tag("", :id => "tr8n_form") do %>
  <%= hidden_field_tag(:type, "application_language") %>
  <%= will_filter_table_tag(@results, :columns => [
    [:flag, lambda{|al| al.language ? image_tag("tr8n/flags/#{al.language.flag}.png") : ''}, :style => 'width:20px;', :title => ''],
    [:checkbox, 'ids'],     
    [:id, lambda{|al| al.language ?  al.language.id : ''}, 'width:60px;'],
    [:locale, lambda{|al|
      lang = al.language
      html = []
      if lang.enabled?
        html << '<span style="color:green">'
      else  
        html << '<span style="color:red">'
      end
      html << lang.locale
      html << '</span>'
      html.join(' ').html_safe
    }, 'width:30px;'],
    [:english_name, lambda{|al| link_to(al.language.english_name, :controller=>"/tr8n/admin/language", :action => :view, :id => al.language.id)}],
    [:actions, lambda{|al|
      tr8n_actions_tag([
        link_to_function("Remove", "deleteObjects('#{al.id}')")
      ])
    }, 'padding:5px;text-align:right;white-space:nowrap;width:200px;']        
  ]) %>
<% end %>

<%= will_filter_actions_bar_tag(@results, [
  ['Remove From Application', 'deleteObjects()']
]) %>

